<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <title></title>
    </head>
    <body>
       
        <script type="text/javascript">
            //延迟函数
            var fn1 = function(color){
                document.body.style.backgroundColor = color;
               
            };
           var timeoutId = setTimeout(function(){
                fn1("pink");
            },1000);
            //间隔函数
            
           var intervalId = setInterval(function(){
                var time = new Date();
                document.body.innerHTML = time;
            },1000)

            //清除
            setTimeout(function(){
                clearInterval(intervalId);
                clearTimeout(timeoutId);
            },3000)
        
        </script>
    </body>
</html>